package com.hou.eduservice.controller.front;

import com.hou.commonutils.R;
import com.hou.eduservice.entity.EduCourse;
import com.hou.eduservice.entity.EduTeacher;
import com.hou.eduservice.service.EduCourseService;
import com.hou.eduservice.service.EduTeacherService;
import org.bouncycastle.asn1.crmf.PKIPublicationInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shkstart
 * @create 2021-11-14-15:45
 */
@RestController
@RequestMapping("/eduservice/indexfront")
@CrossOrigin
public class IndexFrontController {

    @Autowired
    private EduCourseService courseService;
    @Autowired
    private EduTeacherService teacherService;

    // 查询前4条热门课程
    @GetMapping("getHotCourse")
    public R getHotCourse() {
        List<EduCourse> hotCourse = courseService.getHotCourse();
        return R.ok().data("hotCourse",hotCourse);
    }

    // 获取前8名高级讲师
    @GetMapping("getHotTeacher")
    public R getHotTeacher() {
        List<EduTeacher> hotTeacher = teacherService.getHotTeacher();
        return R.ok().data("hotTeacher",hotTeacher);
    }


}
